﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using QuanLyBanHang.Lib;

namespace QuanLyBanHang.GUI
{
    public partial class frmDSKH : Form
    {
        #region "Variables"
        public string _MaKH;
        public DataTable _dtbKhachHang = KetNoi.GetTable("select * from tblKhachHang");
        #endregion
        public frmDSKH()
        {
            InitializeComponent();
        }

        private void frmDSKH_Load(object sender, EventArgs e)
        {
            dataGridView1.DataSource = _dtbKhachHang;
            dataGridView1.AllowUserToAddRows = false;
            dataGridView1.AllowUserToDeleteRows = false;
            dataGridView1.Columns["MaKH"].HeaderText = "Mã khách hàng";
            dataGridView1.Columns["TenKH"].HeaderText = " Tên khách hàng";
            dataGridView1.Columns["DiaChi"].HeaderText = "Địa chỉ";
            dataGridView1.Columns["SoDT"].HeaderText = "Nhà cung cấp";
        }

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
        }

        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            _MaKH = _dtbKhachHang.Rows[e.RowIndex]["MaKH"].ToString();
            this.Close();
        }

    }
}
